package com.example.d9_tz;

public class MyRunnable1 implements Runnable {
    private int count;

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            // synchronized是一种悲观锁,每次上来都先加锁
            synchronized (this) {
                System.out.println(Thread.currentThread().getName() + "count ======>" + (++count));
            }
        }
    }
}
